from langchain_text_splitters import CharacterTextSplitter

text = "abcdefg.hijkllm.nopqrst.uvwxyz"

text_splitter = CharacterTextSplitter(
    chunk_size=7,
    chunk_overlap=3,
    separator=".",#按句号分割
    is_separator_regex=False
)

chunks = text_splitter.split_text(text)
print("分割块数:",len(chunks))
for i,chunk in enumerate(chunks):
    print(f"块{i+1}:{chunk}")